home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _5327F9275B684F4F92FCAC5CCA426963 < prev    next >
Encoding:
Text File  |  2004-01-06  |  3.3 KB  |  169 lines

  1. UI.PageConfirmation=
  2. {
  3.     GUI=
  4.     {
  5.         background=
  6.         {
  7.             classname = "static",
  8.             left = 0, top = 0,
  9.             width = 800, height = 600,
  10.             
  11.             color = UI.szMessageBoxScreenColor,
  12.             
  13.             zorder = 500,    -- must be above all
  14.         },
  15.                 
  16.         border01=
  17.         {
  18.             skin = UI.skins.MenuBorder,
  19.         
  20.             left = 225, top = 175,
  21.             width = 350, height = 250,
  22.             color = UI.szMessageBoxColor,
  23.             
  24.             zorder = 505,
  25.             
  26.             border02=
  27.             {
  28.                 left = 0, top = 24,
  29.                 height = 8, width = 350,
  30.                 bordersides = "tb",
  31.                 
  32.                 skin = UI.skins.MenuBorder,
  33.             },
  34.             
  35.             border03=
  36.             {
  37.                 left = 0, top = 250 - 8 - 24,
  38.                 height = 8, width = 350,
  39.                 bordersides = "tb",
  40.                 color = "0 0 0 0",
  41.                 
  42.                 skin = UI.skins.MenuBorder,
  43.             },
  44.             
  45.             Title=
  46.             {
  47.                 classname = "static",
  48.                 left = 1, top = 1,
  49.                 height = 23, width = 348,
  50.                 color = "0 0 0 0",
  51.                 
  52.                 halign = UIALIGN_CENTER,
  53.                 
  54.                 bordersize = 0,
  55.             },
  56.  
  57.             Label=
  58.             {
  59.                 classname = "static",
  60.                 left = 0, top = 24+8,
  61.                 width = 350, height = 250 - 25*2-8,
  62.                 color = "0 0 0 0",
  63.                 
  64.                 bordersize = 0,
  65.                 
  66.                 halign = UIALIGN_CENTER,
  67.                 valign = UIALIGN_MIDDLE,
  68.                 
  69.                 style = UISTYLE_MULTILINE + UISTYLE_WORDWRAP,
  70.  
  71.                 zorder = 510,
  72.             }
  73.         },
  74.             
  75.         Yes=
  76.         {
  77.             skin = UI.skins.TopMenuButton,
  78.             
  79.             left = 225, top = 175 + 250 - 25,
  80.             width = 100, height = 25,
  81.             
  82.             text = Localize("Yes"),
  83.             
  84.             tabstop = 1,
  85.             
  86.             zorder = 510,
  87.             
  88.             OnCommand = function(Sender)
  89.                 UI:DeactivateScreen("ConfirmationDialog");
  90.  
  91.                 if (UI.PageConfirmation.OnYes) then
  92.                     UI.PageConfirmation.OnYes();
  93.                 end
  94.             end
  95.         },
  96.         
  97.         No=
  98.         {
  99.             skin = UI.skins.TopMenuButton,
  100.             
  101.             left = 225 + 350 - 100, top = 175 + 250 - 25,
  102.             width = 100, height = 25,
  103.             
  104.             text = Localize("No"),
  105.             
  106.             tabstop = 2,
  107.             
  108.             zorder = 510,
  109.  
  110.             OnCommand = function(Sender)
  111.                 UI:DeactivateScreen("ConfirmationDialog");
  112.  
  113.                 if (UI.PageConfirmation.OnNo) then
  114.                     UI.PageConfirmation.OnNo();
  115.                 end
  116.             end
  117.         },
  118.         
  119.         OnUpdate = function(Sender)
  120.             local szKeyName = Input:GetXKeyPressedName();
  121.                     
  122.             if (szKeyName == "return") or (szKeyName == "numpad enter") then
  123.                 Input:ResetKeyState(szKeyName);
  124.                             
  125.                 Sender.Yes.OnCommand(Sender.Yes);
  126.             end
  127.         end,
  128.         
  129.         OnActivate = function(Sender)
  130.             
  131.             UI:ShowMouseCursor();
  132.             UI:SetFocusScreen(Sender);
  133.             UI:EnableSwitch(0);
  134.             
  135.             if (UI.PageConfirmation.szTitleText) then
  136.                 Sender.border01.Title:SetText(UI.PageConfirmation.szTitleText);
  137.                 UI.PageConfirmation.szTitleText = nil;
  138.             else
  139.                 Sender.border01.Title:SetText("");
  140.             end
  141.             
  142.             if (UI.PageConfirmation.szMessage) then
  143.                 Sender.border01.Label:SetText(UI.PageConfirmation.szMessage);
  144.                 UI.PageConfirmation.szMessage = nil;
  145.             else
  146.                 Sender.border01.Label:SetText("");
  147.             end
  148.         end,
  149.         
  150.         OnDeactivate = function(Sender)
  151.             UI:SetFocusScreen();
  152.             UI:EnableSwitch(1);
  153.         end,
  154.     }
  155. }
  156.  
  157. UI:CreateScreenFromTable("ConfirmationDialog", UI.PageConfirmation.GUI);
  158.  
  159.  
  160. -----------------------------------------------------------------------
  161. function UI.YesNoBox(Title, Message, OnYesProc, OnNoProc)
  162.  
  163.     UI.PageConfirmation.szTitleText = Title;
  164.     UI.PageConfirmation.szMessage = Message;
  165.     UI.PageConfirmation.OnYes = OnYesProc;
  166.     UI.PageConfirmation.OnNo = OnNoProc;
  167.     
  168.     UI:ActivateScreen("ConfirmationDialog");    
  169. end